package game.leon.engine.script;

/**
 * User: bianpeng
 * Date: 12-2-3
 */
public class Reader {
    private Buffer buffer;
    private Source source;
    public Reader(Source source) {
        this.source = source;
        this.buffer = new Buffer(source.bufsize());
    }
    public int read() {
        if (buffer.full()) {
            source.fillBuffer(buffer);
        }
        if (buffer.full()) return -1;
        return buffer.look();
    }
    public void advance() {
        buffer.advance(1);
    }
}
